<?php
namespace app\common\validate;

use think\Validate;

class Abc extends Validate
{
    protected $rule = [
        'mobile'  =>  'require|checkName:/^1[3-9]\d{9}$/',
        'v_token' => 'token',
    ];

    protected $message  =   [
        'mobile.require' => '手机号为必填',
    ];

    // 自定义验证规则
    protected function checkName($value,$rule,$data) {
        return preg_match($rule, $value) ? true : '非法的手机号';
    }

    protected $scene = [
        'insert'  =>  ['mobile'],
    ];
}
